﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
checkadmin(1)
dim ids,listtype,specialid,tablename,from,spids, spid,spid_arr
ids=request.form("id")
listtype=request.Form("listtype")
specialid=request.Form("specialid")
S_LANG=request.Form("lang")
select case listtype
	case "product":
		tablename="c_product"
		from="product_list.asp"
	case "article":
		tablename="c_article"
		from="article_list.asp"
	case "photo":
		tablename="c_photo"
		from="photo_list.asp"
	case "ad":
		tablename="c_ad"
		from="ad_list.asp"
end Select
Dim rs,sql
spids=","&specialid&","
Set rs = server.CreateObject("adodb.recordset")
sql="select * from ["&tablename&"] where id in ( " & ids & ")"
rs.open sql,conn,1,3
Do While Not rs.eof
If rs("specialid")<>specialid Then 
	If InStr(spids,","&rs("specialid")&",")=0 And rs("specialid")<>0 Then 
	spids=spids&rs("specialid")&","
	End If 
	rs("specialid")=specialid
	rs("modifytime")=Now()
	rs.update
End If 
rs.movenext
Loop 
rs.close
Set rs=Nothing
spids=Replace(spids,",,",",")
spids=Mid(spids,2,Len(spids)-2)
spid_arr=Split(spids,",")
Dim i
For i=0 To UBound(spid_arr)
	If isNumber(spid_arr(i)) Then 
		Set rs = server.CreateObject("adodb.recordset")
		sql="select * from [c_special] where id ="&spid_arr(i)
		rs.open sql,conn,1,3
		if Not rs.eof Then 
		rs("modifytime")=Now()
		rs.update
		End If
		rs.close
		Set rs=Nothing
	End If 
Next 
response.redirect("showmsg.asp?from="&from&"&msg=ModifySuccess&lang="&S_LANG)
%>